import React from 'react';
import {Checkbox} from 'antd';
import {WeaFormItem, WeaInput, WeaSelect } from 'ecCom';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

// More地址
class EMoreAddress  extends React.Component {
    state = {
        eMoreAddress: this.props.eMoreAddress || '',
        eMoreShowType: this.props.eMoreShowType || '0'
    };

    render() {
        const {eMoreAddress, eMoreShowType} = this.state;
        const options = [
            {
                key: "0",
                selected: true,
                showname: getLabel(149,'默认')
            },{
                key: "1",
                selected: false,
                showname: getLabel(131372,'自定义')
            }
        ];
        return (
            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@dhzmpn`} label={getLabel(386563,'More地址') } labelCol={{span: 6}} wrapperCol={{span: 16}}>
                <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@g1bt2d`}
                    options={options}
                    style={{width: '80px', marginRight: '8px'}}
                    value={eMoreShowType}
                    viewAttr={2}
                    onChange={(v)=> {this.setState({eMoreShowType : v})}}
                />
                {
                    eMoreShowType == '1' && <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@n4168l`}
                        style={{ width: 'calc(100% - 88px)' }}
                        helpfulTip={getLabel(386567, '外部地址，请在地址前加上http://或https://')}
                        value={eMoreAddress}
                        onChange={(v)=> {this.setState({eMoreAddress : v})}}
                        i18nLengthValidate={{
                            maxLength: 100,
                            errorMessage: "max length",
                            tipPosition: "bottom"
                        }}
                    />
                }
            </WeaFormItem>
        );
    }

    getSaveValues() {
        return this.state;
    }
}

export default EMoreAddress ;
